<template>
  <ant-modal modalWidth="1000" modalHeight="600" :visible="open" :modal-title="formTitle" :adjust-size="true" :maskClosable="false"
    @cancel="cancel">
    <a-form-model ref="form" :model="form" :rules="rules" slot="content" layout="vertical">
      <a-spin :spinning="loading">
      <a-row :gutter="32">
        <a-col :span="24">
          <a-card :bordered="false">
              <advance-table
                :components="drag(columns,'produceProductDetail')"
                :columnsTitle="'produceProductDetail'"
                rowKey="id"
                size="middle"
                :columns="columns"
                :data-source="productList"
                :rowClassName="getRowClassName" 
                :customRow="customRow"
                :pagination="false"
                :bordered="true"
              >
                <div class="table-operations" slot="button" style='margin-bottom:0px;'>
                  <div class="table_title">产品明细</div>
                </div>
              </advance-table>
              <advance-table
                :components="drag(columns1,'produceProcessDetail')"
                :columnsTitle="'produceProcessDetail'"
                rowKey="id"
                size="middle"
                :columns="columns1"
                :data-source="processList[currentIndex]" 
                :pagination="false"
                :bordered="true"
                :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
              >
                <div class="table-operations" slot="button" style='margin-bottom:0px;'>
                  <div class="table_title">工序明细</div>
                  <a-button v-if="!disabled" type="primary" @click="onSearchPlan"  >
                    <a-icon type="plus" />工序计划
                  </a-button>
                  <a-button v-if="!disabled" type="primary" @click="onSearchProcess"  >
                    <a-icon type="plus" />新增
                  </a-button>
                  <a-button type="danger" v-if="multiple && !disabled" @click="handleDeleteRows">
                    <a-icon type="delete" />删除
                  </a-button>
                </div>
                
                <span slot="processName" slot-scope="{record,index}">
                    <a-input placeholder="请选择工序" v-model="record.processName"
                     :readOnly="true" />
                </span>
                <span slot="processVol" slot-scope="{record}">
                    <a-input v-model="record.processVol"></a-input>
                </span>
                <span slot="unitSalary" slot-scope="{record}">
                  <a-input v-model="record.unitSalary"></a-input>
                </span>
                <span slot="sortNumber" slot-scope="{record}">
                  <a-input v-model="record.sortNumber"></a-input>
                </span>
                <span slot="remark" slot-scope="{record}">
                  <a-input v-model="record.remark"></a-input>
                </span>
              </advance-table>
            </a-card>
        </a-col>
      </a-row>
    </a-spin>
    
    <process-add-form
      v-if="showAddSubModal"
      ref="processAddForm"
      @ok="selectProcess"
      @close="showAddSubModal = false"
    />
    
      <!--设置工序-->
      <biz-product-set-process
        v-if="showProcessModal"
        ref="bizProductSetProcess"
        @ok="selectProcessByPlan"
        @close="showProcessModal = false"
      />
    </a-form-model>
    <template slot="footer">
      
      <a-button type="primary" @click="submitForm(true)" :disabled="loading"  v-hasPermi="['biz:bizOrder:edit']">
            保存
      </a-button>
      <a-button :disabled="disabled" @click="cancel">
        取消
      </a-button>
    </template>
  </ant-modal>
</template>
<script>
import BizOrderProduceForm from './BizOrderProduceForm'
import BizOrderPlanForm from './BizOrderPlanForm.vue'
export default {
  ...BizOrderProduceForm,
  BizOrderPlanForm
  
}
</script>
<style lang="less" scoped>
.table-operations,
body tr.ant-table-expanded-row:hover .table-operations {
  padding-bottom: 8px;
  text-align: right;
}

.table-operations {
  margin-bottom: 16px;
}

.table-operations>button,
.table-operations .ant-input-affix-wrapper {
  margin-right: 8px;
}

.table_title {
  float: left;
  padding-left: 8px;
  font-weight: 600;
  color: #222222;
  line-height: 30px;
}
  .selected_table_row{
    background-color: #F0F5FF;
  }
</style>